#define _CRT_SECURE_NO_WARNINGS 1

#include <iostream>
using namespace std;

class Date
{
public:
	Date(int year, int month, int day)
		:_year(year)
		, _month(month)
		, _day(day)
	{}

	int SumMonthDay(int year, int month)
	{
		int array[] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
		if (month >= 2)
		{
			if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0)))
			{
				++array[2];
			}
		}
		int sum = 0;
		for (int i = 1; i < month; ++i)
		{
			sum += array[i];
		}
		return sum;
	}
	int CountDay()
	{
		int count = SumMonthDay(_year, _month);
		count += _day;
		return count;
	}

private:
	int _year;
	int _month;
	int _day;
};

int main()
{
	int year = 0, month = 0, day = 0;
	cin >> year >> month >> day;
	Date d(year, month, day);
	cout << d.CountDay() << endl;
	return 0;
}
